#include <iostream>
#include "../../comlink/link/link.h"
#include "../../comlink/linkslist/linkslist.h"
#include "../../comlink/linkcontrol/linkcontrol.h"
#include "../../processor/processor.h"

Processor * CreateStandAloneProcessor(LinksList * links, unsigned int processorAddress, bool value)
{
  bool * tempLinkBuff[8];

  for(int count = 0; count < 8; count++)
  {
    tempLinkBuff[count] = links->CreateNewLink();
  }

  return new Processor(processorAddress, tempLinkBuff, value);
}


int main(int argc, char ** argv)
{
  // processor 
  Processor * ProcessorList[8][8];

  
  int outerLoop, innerLoop;

  // Create a linked list for holding the physical links
  LinksList * links = new LinksList();

  // create top row
  for(int inLoop = 0; inLoop < 8; inLoop++)
  {
    ProcessorList[0][inLoop] = CreateStandAloneProcessor(links, inLoop, true);
  }



  for(int outLoop = 0; outLoop < 8; outLoop++)
  {
    for(int inLoop = 0; inLoop < 8; inLoop++)
    {
      ProcessorList[outLoop][inLoop] = CreateStandAloneProcessor(links, (inLoop + (8 * outLoop)), true);
    }
  }

  // reclaima and release memory
  for(int outLoop = 0; outLoop < 8; outLoop++)
  {
    for(int inLoop = 0; inLoop < 8; inLoop++)
    {
      delete ProcessorList[outLoop][inLoop];
    }
  }

  delete links;

  return 1;
}
